<template>
  <div>
    <h1>Login</h1>
    <div class="form-group">
      <label for="email">Email</label>
      <input type="email" class="form-control" id="email" placeholder="Enter email" />
    </div>
    <div class="form-group">
      <label for="password">Password</label>
      <input type="password" class="form-control" id="password" placeholder="Password" />
    </div>
    <button type="submit" class="btn btn-primary">Submit</button>
  </div>
</template>

<script>
import jsCookie from "js-cookie";
export default {
  name: "login",
  data() {
    return {
      msg: "Welcome to Your Vue.js App",
    };
  },
  mounted() {
    let geturl = window.location.href;
    let getqyinfo = geturl.split("?")[1];
    let getqys = new URLSearchParams("?" + getqyinfo); //将参数放在URLSearchParams函数中
    let code = getqys.get("code"); //1001
    if (code == 2001) {
      let token = getqys.get("token");
      let username = getqys.get("username");
      console.log(token)
      console.log(username)
      jsCookie.set("username", username, { expires: 7 });
      jsCookie.set("token", token, { expires: 7 });
      this.$router.push("/BigData");
    }
  },
};
</script>

<style>
</style>